TrayItem Class

Used to add items to the System Tray. Windows only.

Events

Action


Properties

HelpTag

Icon


Methods

None

More information available in parent classes: Object


Example

Add an instance of the TrayItem class to your project and then instantiate it in the Open event of the App object, i.e.,

myTrayItem = New MyAppTrayItem
Me.AddTrayItem( myTrayItem )

The following code in the Action event of a TrayItem handles mouse clicks and double-clicks.

If cause = TrayItem.LeftMouseButton then
  MsgBox "Left Mouse Button Down"
elseif cause = TrayItem.RightMouseButton then
  Dim mnu as new MenuItem
    
 mnu.Append( New MenuItem( "&About" ) )
 mnu.Append( new MenuItem( MenuItem.TextSeparator ) )
 mnu.Append( new MenuItem( "E&xit" ) )
  Dim results as MenuItem
 results = mnu.PopUp
    
 if results <> Nil then
  select case results.Text
   case "E&xit"
   Quit
  case "&About"
   MsgBox "The REALbasic TrayItem demo."
        
  end select
 end if
    
elseif cause = TrayItem.DoubleClick then
  MsgBox "Double Click"
end if

When the application quits, you call the RemoveTrayItem method of the Application class. This goes in the Close event handler of the App object.

Me.RemoveTrayItem(myTrayItem)